import request from '@/utils/request'

// 查询机器人命令列表
export function listCommand(query) {
  return request({
    url: '/tenant/command/list',
    method: 'get',
    params: query
  })
}

// 查询机器人命令详细
export function getCommand(commandId) {
  return request({
    url: '/tenant/command/' + commandId,
    method: 'get'
  })
}

// 新增机器人命令
export function addCommand(data) {
  if(data.commandType == 0){
    data.locationId = null;
  }
  return request({
    url: '/tenant/command',
    method: 'post',
    data: data
  })
}

// 修改机器人命令
export function updateCommand(data) {
  if(data.commandType == 0){
    data.locationId = null;
  }
  return request({
    url: '/tenant/command',
    method: 'put',
    data: data
  })
}

// 删除机器人命令
export function delCommand(commandId) {
  return request({
    url: '/tenant/command/' + commandId,
    method: 'delete'
  })
}
